//
//  DHOrderCell.m
//  精品酒店
//
//  Created by DIANGHONG on 2018/5/10.
//  Copyright © 2018年 DIANGHONG. All rights reserved.
//

#import "DHOrderCell.h"
@interface DHOrderCell()
@property (weak, nonatomic) IBOutlet UILabel *orderNumber; // 订单号
@property (weak, nonatomic) IBOutlet UIImageView *orderImageView; // 订单图片
@property (weak, nonatomic) IBOutlet UILabel *orderTitle; // 订单标题
@property (weak, nonatomic) IBOutlet UILabel *isFinishLabel; // 是否退房
@property (weak, nonatomic) IBOutlet UILabel *endTimeLabel; // 截止时间
@property (weak, nonatomic) IBOutlet UIButton *locButton; // 定位按钮
@property (weak, nonatomic) IBOutlet UILabel *priceLabel; // 预计收入
@property (weak, nonatomic) IBOutlet UIButton *orderButton; // 立即预约

@end
@implementation DHOrderCell

- (void)setOrderModel:(DHOrderModel *)orderModel{
    _orderModel = orderModel;
    
    self.orderNumber.text = orderModel.order_id;
    [self.orderImageView sd_setImageWithURL:[NSURL URLWithString:orderModel.logo]];
    self.orderTitle.text = orderModel.title;
    self.endTimeLabel.text = orderModel.end_time;
    [self.locButton setTitle:[NSString stringWithFormat:@"%@.%@",orderModel.city,orderModel.area] forState:UIControlStateNormal];
    self.priceLabel.text = [NSString stringWithFormat:@"%@元",orderModel.price];
    self.isFinishLabel.text = orderModel.type;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.orderButton.layer.masksToBounds = true;
    self.orderButton.layer.cornerRadius = 8;
    
    self.locButton.imageView.contentMode = UIViewContentModeScaleAspectFill;
    
    [self.orderButton addTarget:self action:@selector(orderButtonClick) forControlEvents:UIControlEventTouchUpInside];
}
- (void)orderButtonClick
{
    [self.delegate orderCellSelectedOrderButtonClick:self];
}
@end
